package com.jfinal.aceadmin.controller;

import java.util.List;

import com.jfinal.aceadmin.model.ChatImpl;
import com.jfinal.aceadmin.vo.ChatLogVo;
import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;

@ControllerBind(controllerKey = "/admin/chatlog")
public class ChatLogController extends Controller {

	public void chatRecords(){
		List<ChatLogVo> chatLogVos = ChatImpl.getDAO().getRecentChatLogs();
		renderJson(chatLogVos);
	}
	
	public void add(){
		String content = getPara("content");
		String username = getSessionAttr("name");
		ChatImpl.getDAO().addChat(content,username);
		renderJson("{\"success\":true}");
	}
}
